﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using MoneyManagerNET.Model;

namespace CaliburnWpf.ViewModels
{
    public class TransactionStatusConverter:IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (targetType == typeof(TransactionStatus))
                return (TransactionStatus)value;

            if (targetType == typeof(string))
                return System.Convert.ToString((TransactionStatus)value);

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (targetType == typeof(byte))
                return (byte)value;

            if (targetType == typeof(TransactionStatus))
                return (TransactionStatus)(byte)value;

            return null;
        }
    }
}
